﻿#region System Namespace
#endregion System Namespace

#region Foreign Namespace
#endregion Foreign Namespace

#region Styx Namespace

using Styx;
using Styx.CommonBot.Frames;
using Styx.Pathing;
using Styx.Plugins;
#endregion Styx Namespace
/*
 Filename: StartConfirmAuction.lua
 * hideOnEscape = 0,
 * enterClicksFirstButton=false,
 */

namespace Auction
{
    public partial class Auction
    {
        public override void Pulse()
        {
            if (StyxWoW.Me.Level < 5)
            {
                if (CanMoveToMailbox())
                {
                    Navigator.MoveTo(MoveToMailbox());
                    Log("Moving to Mailbox");
                    if (MoveToMailbox().Distance(StyxWoW.Me.Location) < 6)
                    {
                        InteractWithMail();
                        if (new MailFrame().IsVisible)
                        {
                            OpenMail();
                        }
                    }
                }
                if (CanMoveToAuctioneer())
                {
                    while (!CanInteractWithAuctioneer())
                    {
                        Navigator.MoveTo(MoveToAuctioneer());
                        Log("Moving to Auctioneer");
                    }
                }
                if (CanInteractWithAuctioneer())
                {
                    if (!AuctionFrameVisible())
                    {
                        InteractWithAuctioneer();
                    }
                    else if (AuctionFrameVisible())
                    {
                        Query();
                    }
                }
            }
        }
    }
}